package com.example.buyticketlishi.wightview;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.example.baselibrary.Utils.Customer;
import com.example.baselibrary.Utils.SPUtils;
import com.example.baselibrary.Utils.SelfToastUtil;
import com.example.baselibrary.Utils.StringUtil;
import com.example.buyticketlishi.R;
import com.example.buyticketlishi.view.ac.LiShiSettingActivity;


public class KouLingBottom extends BottomDialogBase {

    private Context context;
    private EditText etKou;
    private Button btKouConfig;



    public KouLingBottom(final Context context) {
        super(context);
        this.context = context;

        btKouConfig.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (StringUtil.isNullOrEmpty(etKou.getText().toString())) {
                    SelfToastUtil.getInstance().show("请先输入口令");
                    return;
                }else {
                    if (etKou.getText().toString().equals((String) SPUtils.get(context, Customer.LISHI_PASSWORD, ""))) {
                        //如果相等，那么就去跳转页面
                        context.startActivity(new Intent(context, LiShiSettingActivity.class));
                        dismiss();
                    }else {
                        SelfToastUtil.getInstance().show("口令有误，请和管理员确认");
                        return;
                    }
                }
            }
        });


    }

    @Override
    protected void onCreate() {
        setContentView(R.layout.wight_kouling_bottom_new);

        etKou = findViewById(R.id.et_kou_ling);
        btKouConfig = findViewById(R.id.bt_kouling_config);


    }
}
